<html>
<head><meta charset="utf-8"><title>type aliases and semver stability · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/type.20aliases.20and.20semver.20stability.html">type aliases and semver stability</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="168806955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/type%20aliases%20and%20semver%20stability/near/168806955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/type.20aliases.20and.20semver.20stability.html#168806955">(Jun 23 2019 at 20:24)</a>:</h4>
<p>Is it semver-OK to replace</p>
<div class="codehilite"><pre><span></span><span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">Foo</span><span class="p">;</span><span class="w"></span>
</pre></div>


<p>with </p>
<div class="codehilite"><pre><span></span><span class="k">pub</span><span class="w"> </span><span class="k">type</span> <span class="nc">Foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">RenamedFoo</span><span class="p">;</span><span class="w"></span>
<span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">RenamedFoo</span><span class="p">;</span><span class="w"></span>
</pre></div>



<a name="168807734"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/type%20aliases%20and%20semver%20stability/near/168807734" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/type.20aliases.20and.20semver.20stability.html#168807734">(Jun 23 2019 at 20:51)</a>:</h4>
<p>(nuked)</p>



<a name="168807739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/type%20aliases%20and%20semver%20stability/near/168807739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/type.20aliases.20and.20semver.20stability.html#168807739">(Jun 23 2019 at 20:51)</a>:</h4>
<p>There may be an interac tion with value-namespace</p>



<a name="168807740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/type%20aliases%20and%20semver%20stability/near/168807740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/type.20aliases.20and.20semver.20stability.html#168807740">(Jun 23 2019 at 20:51)</a>:</h4>
<p>let me do a test</p>



<a name="168807799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/type%20aliases%20and%20semver%20stability/near/168807799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/type.20aliases.20and.20semver.20stability.html#168807799">(Jun 23 2019 at 20:53)</a>:</h4>
<p>You need <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=69454e14bb1773f46be89a11ef7dbf58" target="_blank" title="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=69454e14bb1773f46be89a11ef7dbf58">something like this</a> as <code>type</code> does not introduce a name into the type-namespace.</p>



<a name="168808964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/type%20aliases%20and%20semver%20stability/near/168808964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/type.20aliases.20and.20semver.20stability.html#168808964">(Jun 23 2019 at 21:31)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> thank you. How specific is that to my (arbitrary) choice of syntax? e.g. I really have a <code>struct Foo { … }</code></p>



<a name="168809026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/type%20aliases%20and%20semver%20stability/near/168809026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/type.20aliases.20and.20semver.20stability.html#168809026">(Jun 23 2019 at 21:33)</a>:</h4>
<p>Unit structs introduce a name into the value-namespace and so does a tuple struct.</p>



<a name="168809066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/type%20aliases%20and%20semver%20stability/near/168809066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/type.20aliases.20and.20semver.20stability.html#168809066">(Jun 23 2019 at 21:34)</a>:</h4>
<p>If you have a struct-struct, then just type alias is sufficient I think.</p>



<a name="168809069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/type%20aliases%20and%20semver%20stability/near/168809069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/type.20aliases.20and.20semver.20stability.html#168809069">(Jun 23 2019 at 21:35)</a>:</h4>
<p>it may also be sufficient for tuple structs in case its fields are private.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>